package com.spring.service.impl;

import com.spring.dao.ClassNameDao;
import com.spring.pojo.ClassName;
import com.spring.service.ClassNameService;
import org.apache.commons.collections4.functors.ExceptionClosure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2022-02-17 10:39:16
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2022-02-17     张李鑫                     1.0         1.0 Version
 */
@Service
public class ClassNameServiceImpl implements ClassNameService {
    @Autowired
    private ClassNameDao classNameDao;

    @Autowired
    private ClassNameService classNameService;


    @Transactional(rollbackFor = Exception.class)
    @Override
    public void add() {
        ClassName className = new ClassName();
        className.setClassName("className");
        classNameDao.insert(className);

    }

    @Override
    public void addI() {
        this.exception();
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void exception() {
        ClassName className = new ClassName();
        className.setClassName("className_ex");
        classNameDao.insert(className);
        throw new RuntimeException();

    }
}
